<?php


namespace App\Controller;

use Hyperf\HttpServer\Annotation\AutoController;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Annotation\Middlewares;
use App\Middleware\FooMiddleware;
use App\Middleware\BarMiddleware;
use App\Middleware\BazMiddleware;

/**
 * @AutoController()
 * @Middlewares(
 *     @Middleware(BarMiddleware::class),
 *     @Middleware(BazMiddleware::class)
 * )
 * Class Demo04Controller
 * @package App\Controller
 */
class Demo04Controller
{
    public function index(){
        # 中间讲 执行顺序 先执行配置文件>类上面定义的>最后才是方法的
        return 'index';
    }

    /**
     * @Middleware(FooMiddleware::class)
     * @return string
     */
    public function index2(){
        # 先执行类上面的然后在执行方法的
        return 'index2';
    }
}